<?php
	/**
	 * This is a quick-and-dirty draft QPanel object to do Create, Edit, and Delete functionality
	 * of the TableUserProfile class.  It uses the code-generated
	 * TableUserProfileMetaControl class, which has meta-methods to help with
	 * easily creating/defining controls to modify the fields of a TableUserProfile columns.
	 *
	 * Any display customizations and presentation-tier logic can be implemented
	 * here by overriding existing or implementing new methods, properties and variables.
	 * 
	 * NOTE: This file is overwritten on any code regenerations.  If you want to make
	 * permanent changes, it is STRONGLY RECOMMENDED to move both table_user_profile_edit.php AND
	 * table_user_profile_edit.tpl.php out of this Form Drafts directory.
	 *
	 * @package My Application
	 * @subpackage Drafts
	 */
	class TableUserProfileEditPanel extends QPanel {
		// Local instance of the TableUserProfileMetaControl
		protected $mctTableUserProfile;

		// Controls for TableUserProfile's Data Fields
		public $lblId;
		public $lstUser;
		public $txtCompanyUser;
		public $txtCatchPhrase;
		public $txtLanguageDescription;
		public $txtKeywordDescription;
		public $txtMessage;
		public $txtLocation;
		public $txtCustomerCount;
		public $txtRepeaterCount;
		public $txtWonProjectCount;
		public $txtCompletedWonProjectCount;
		public $txtFailedWonProjectCount;
		public $txtPostProjectCount;
		public $txtCompletedPostProjectCount;
		public $txtFailedPostProjectCount;
		public $txtBidProjectCount;
		public $txtBidProjectCountThisMonth;
		public $txtWonProjectReviewCount;
		public $txtWonProjectPositiveReviewCount;
		public $txtWonProjectNeutralReviewCount;
		public $txtWonProjectNegativeReviewCount;
		public $txtPostProjectReviewCount;
		public $txtPostProjectPositiveReviewCount;
		public $txtPostProjectNeutralReviewCount;
		public $txtPostProjectNegativeReviewCount;
		public $txtSuspendCount;
		public $txtPaypalEmail;
		public $txtLimitedIp;
		public $calUpdateDate;
		public $txtVision;
		public $txtAreaOfExpertise;
		public $txtCompletionRatio;
		public $txtBudgetPaidRatio;
		public $txtPaginationNumber;
		public $txtLandingPage;

		// Other ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References

		// Other Controls
		public $btnSave;
		public $btnDelete;
		public $btnCancel;

		// Callback
		protected $strClosePanelMethod;

		public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) {
			// Call the Parent
			try {
				parent::__construct($objParentObject, $strControlId);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Setup Callback and Template
			$this->strTemplate = 'TableUserProfileEditPanel.tpl.php';
			$this->strClosePanelMethod = $strClosePanelMethod;

			// Construct the TableUserProfileMetaControl
			// MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
			$this->mctTableUserProfile = TableUserProfileMetaControl::Create($this, $intId);

			// Call MetaControl's methods to create qcontrols based on TableUserProfile's data fields
			$this->lblId = $this->mctTableUserProfile->lblId_Create();
			$this->lstUser = $this->mctTableUserProfile->lstUser_Create();
			$this->txtCompanyUser = $this->mctTableUserProfile->txtCompanyUser_Create();
			$this->txtCatchPhrase = $this->mctTableUserProfile->txtCatchPhrase_Create();
			$this->txtLanguageDescription = $this->mctTableUserProfile->txtLanguageDescription_Create();
			$this->txtKeywordDescription = $this->mctTableUserProfile->txtKeywordDescription_Create();
			$this->txtMessage = $this->mctTableUserProfile->txtMessage_Create();
			$this->txtLocation = $this->mctTableUserProfile->txtLocation_Create();
			$this->txtCustomerCount = $this->mctTableUserProfile->txtCustomerCount_Create();
			$this->txtRepeaterCount = $this->mctTableUserProfile->txtRepeaterCount_Create();
			$this->txtWonProjectCount = $this->mctTableUserProfile->txtWonProjectCount_Create();
			$this->txtCompletedWonProjectCount = $this->mctTableUserProfile->txtCompletedWonProjectCount_Create();
			$this->txtFailedWonProjectCount = $this->mctTableUserProfile->txtFailedWonProjectCount_Create();
			$this->txtPostProjectCount = $this->mctTableUserProfile->txtPostProjectCount_Create();
			$this->txtCompletedPostProjectCount = $this->mctTableUserProfile->txtCompletedPostProjectCount_Create();
			$this->txtFailedPostProjectCount = $this->mctTableUserProfile->txtFailedPostProjectCount_Create();
			$this->txtBidProjectCount = $this->mctTableUserProfile->txtBidProjectCount_Create();
			$this->txtBidProjectCountThisMonth = $this->mctTableUserProfile->txtBidProjectCountThisMonth_Create();
			$this->txtWonProjectReviewCount = $this->mctTableUserProfile->txtWonProjectReviewCount_Create();
			$this->txtWonProjectPositiveReviewCount = $this->mctTableUserProfile->txtWonProjectPositiveReviewCount_Create();
			$this->txtWonProjectNeutralReviewCount = $this->mctTableUserProfile->txtWonProjectNeutralReviewCount_Create();
			$this->txtWonProjectNegativeReviewCount = $this->mctTableUserProfile->txtWonProjectNegativeReviewCount_Create();
			$this->txtPostProjectReviewCount = $this->mctTableUserProfile->txtPostProjectReviewCount_Create();
			$this->txtPostProjectPositiveReviewCount = $this->mctTableUserProfile->txtPostProjectPositiveReviewCount_Create();
			$this->txtPostProjectNeutralReviewCount = $this->mctTableUserProfile->txtPostProjectNeutralReviewCount_Create();
			$this->txtPostProjectNegativeReviewCount = $this->mctTableUserProfile->txtPostProjectNegativeReviewCount_Create();
			$this->txtSuspendCount = $this->mctTableUserProfile->txtSuspendCount_Create();
			$this->txtPaypalEmail = $this->mctTableUserProfile->txtPaypalEmail_Create();
			$this->txtLimitedIp = $this->mctTableUserProfile->txtLimitedIp_Create();
			$this->calUpdateDate = $this->mctTableUserProfile->calUpdateDate_Create();
			$this->txtVision = $this->mctTableUserProfile->txtVision_Create();
			$this->txtAreaOfExpertise = $this->mctTableUserProfile->txtAreaOfExpertise_Create();
			$this->txtCompletionRatio = $this->mctTableUserProfile->txtCompletionRatio_Create();
			$this->txtBudgetPaidRatio = $this->mctTableUserProfile->txtBudgetPaidRatio_Create();
			$this->txtPaginationNumber = $this->mctTableUserProfile->txtPaginationNumber_Create();
			$this->txtLandingPage = $this->mctTableUserProfile->txtLandingPage_Create();

			// Create Buttons and Actions on this Form
			$this->btnSave = new QButton($this);
			$this->btnSave->Text = QApplication::Translate('Save');
			$this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
			$this->btnSave->CausesValidation = $this;

			$this->btnCancel = new QButton($this);
			$this->btnCancel->Text = QApplication::Translate('Cancel');
			$this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));

			$this->btnDelete = new QButton($this);
			$this->btnDelete->Text = QApplication::Translate('Delete');
			$this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('TableUserProfile') . '?'));
			$this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
			$this->btnDelete->Visible = $this->mctTableUserProfile->EditMode;
		}

		// Control AjaxAction Event Handlers
		public function btnSave_Click($strFormId, $strControlId, $strParameter) {
			// Delegate "Save" processing to the TableUserProfileMetaControl
			$this->mctTableUserProfile->SaveTableUserProfile();
			$this->CloseSelf(true);
		}

		public function btnDelete_Click($strFormId, $strControlId, $strParameter) {
			// Delegate "Delete" processing to the TableUserProfileMetaControl
			$this->mctTableUserProfile->DeleteTableUserProfile();
			$this->CloseSelf(true);
		}

		public function btnCancel_Click($strFormId, $strControlId, $strParameter) {
			$this->CloseSelf(false);
		}

		// Close Myself and Call ClosePanelMethod Callback
		protected function CloseSelf($blnChangesMade) {
			$strMethod = $this->strClosePanelMethod;
			$this->objForm->$strMethod($blnChangesMade);
		}
	}
?>